﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Dictionary<QualificationLevel, IEnumerable<StudentsGroup>>>" %>
<%@ Import Namespace="Resources" %>
<%@ Import Namespace="ViewRes" %>
<%
    if (Model.Count == 0 || Model.First().Value.Count() == 0)
    {%>
    <span class='mediumBoldText'> <%:SharedStrings.NoGroups%> </span>
<%
    } %>
<%
    else
    {%>
<%
        string defaultAction = ViewData["DefaultAction"] == null ? null : ViewData["DefaultAction"].ToString();
        string confirmationString = null;

        string submitButtonValue = null;
        switch (defaultAction)
        {
            case "Delete":
                submitButtonValue = DiplomaResources.Delete;
                confirmationString = DiplomaResources.DoYouConfirmDeletion;
                break;
            case "Restore":
                submitButtonValue = DiplomaResources.Restore;
                confirmationString = DiplomaResources.DoYouConfirmRestoring;
                break;
            default:
                break;
        }
%>
   
    <%
        using (
            Html.BeginRouteForm("Default", new {controller = "StudentsGroups", action = defaultAction}, FormMethod.Post,
                                new {onSuccess = "loadActiveEntries(); "}))
        {%>
            <%
            foreach (var level in Model)
            {%>
                <div class="mediumBoldText"><%:level.Key.ToString()%></div>
                <ol style="list-style: none outside none;">
                    <%
                foreach (StudentsGroup group in level.Value)
                {%>
                        <%
                    Html.RenderPartial("~/Views/StudentsGroups/ViewGroupControl.ascx", group);%>
                    <%
                }%>
                </ol>
            <%
            }%>
            <hr />
    <input type="submit" value="<%=submitButtonValue%>" onclick=" return deleteEntity(' <%=confirmationString%>', groupDeleted)" />
   <%
        }%>

<%
    }%>